package organization

import "fmt"

type AliyunConfig struct {
	AccessKeyId     string
	AccessKeySecret string
	Region          string
}

func NewAliyun(accessKeyId, accessKeySecret, region string) *Aliyun {
	fmt.Println(accessKeyId, accessKeySecret, region)
	return &Aliyun{
		accessKeyId:     accessKeyId,
		accessKeySecret: accessKeySecret,
		region:          region,
	}
}
func NewAliyunFromConfig() *Aliyun {
	return &Aliyun{}
}

type Aliyun struct {
	accessKeyId     string // AccessKey ID
	accessKeySecret string // AccessKey Secret

	region string // 区域 // cn-wuhan武汉|cn-hongkong香港|cn-hangzhou杭州
}

// 属性操作

func (r *Aliyun) GetAccessKeyId() string {
	return r.accessKeyId
}
func (r *Aliyun) GetAccessKeySecret() string {
	return r.accessKeySecret
}
func (r *Aliyun) Region(region string) *Aliyun {
	r.region = region

	return r
}
func (r *Aliyun) GetRegion() string {
	return r.region
}

// 主体

func (r *Aliyun) GetEndpoint() string {
	return fmt.Sprintf("https://oss-%s.aliyuncs.com", r.region)
}
